/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup;

/**
 * @author: huym
 * @version: 1.0
 * @date: 2020/12/9
 */
public class Cat implements Comparable<Cat> {

    int weight,height;

    public Cat(int weight, int height) {
        this.weight = weight;
        this.height = height;
    }

    // 不推荐在Cat里面直接用比较方法，如果根据其他比较，那么需要修改，程序不灵活
    @Override
    public int compareTo(Cat cat) {
        if (this.weight>cat.weight) return 1;
        else if(this.weight<cat.weight) return -1;
        else return 0;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "weight=" + weight +
                ", height=" + height +
                '}';
    }
}